package com.getword.domain;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;
import java.util.List;


@Document(collection = "comments")
@Setter
@Getter
@ToString
public class Comments implements Serializable {
    @Id
    @Field("_id")
    private String id;

    private String articleId;

    @DBRef
    private User user;
    private Date time;
    private String content;
    /**
     * [{from,to,time,content},{}]
     */
    private List<Reply> replyList;

    public Comments(String id) {
        this.id = id;
    }

    public Comments() {
    }

}
